package wt.hpad.activity.splash;

import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;

import java.util.Timer;
import java.util.TimerTask;

import wt.hpad.R;
import wt.hpad.activity.main.MainActivity;
import wt.hpad.utils.ActivityUtil;
import wt.hpad.utils.AppUtil;

public class SplashActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.splash_act);
        initUI();
        initData();

        new Timer().schedule(new TimerTask() {
            @Override
            public void run() {
                runOnUiThread(new Runnable() {
                    @Override
                    public void run() {
                        startActivity(new Intent(getApplicationContext(), MainActivity.class));
                        finish();
                    }
                });
            }
        }, 2000);
    }

    private void initData() {
        SplashFragment fragment = new SplashFragment();
        ActivityUtil.addFragmentToActivity(getSupportFragmentManager(), fragment, R.id.splash_content);
    }

    private void initUI() {
        AppUtil.hideBarAndTransparentTime(this);
        AppUtil.hideBottomUIMenuAll(this);

    }


}
